﻿ 
//var fs_maxWindow = false;
var customColumns = true;
fs.util.pageLoadFunction.push(function () {
    fs_maxWindow = true;
    firstColumns = [
              { index: 0, headerText: "Base", edit: true, readonly: true, width: 80, rowText: "Budget" },
              { index: 1, headerText: "Actual", edit: true, readonly: true, width: 80, rowText: "Actual" },
              { index: 2, headerText: "Variance", edit: true, readonly: true, width: 80, rowText: "Variance" },
              { index: 4, headerText: "Vol", edit: true, width: 80, rowText: "Vol" },
              { index: 5, headerText: "Mix", edit: true, width: 80, rowText: "Mix" },
              { index: 6, headerText: "Price", edit: true, width: 80, rowText: "Price" },

              { index: 7, headerText: "", edit: false, width: 80, rowText: "empty", readonly: true },

              { index: 8, headerText: "Market price", edit: true, width: 80, rowText: "MP" },
              { index: 9, headerText: "First product price", edit: true, width: 80, rowText: "FPP" },
              { index: 10, headerText: "Productivity", edit: true, width: 80, rowText: "PRO" },
              { index: 11, headerText: "Pass through", edit: true, width: 80, rowText: "PT" },
              { index: 12, headerText: "Others", edit: true, width: 80, rowText: "Others" },
              { index: 7, headerText: "", edit: false, width: 80, rowText: "empty", readonly: true },

              { index: 14, headerText: "Control", edit: true, width: 80, rowText: "Control", style: "red", readonly: true },
              { index: 14, headerText: "Control", edit: true, width: 80, rowText: "Control1", style: "red", readonly: true }
            ];

       
    columnsCategory = [
    { colspan: 6, text: "" },
    { colspan: 3, text: "Total Variance" },
    { colspan: 0, text: "" },
    { colspan: 5, text: "Price Variance" },
    { colspan: 0, text: "" },
    { colspan: 2, text: ""}]
});

var readyJSON = [
{ emptyrow: true, insertcontrol: false, description: "Budget", bold: true },

{ accountcode: "VM02010100", description: "Sales", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Budget: true,
        Exp: {
            mode: "refrence", list: "Budget_PL", fields: ["PL03010102"], equ: "+"
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010102"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }
    }
    , {
        Field: "Vol",
        Exp: {
            mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010100"], equ: "+"
        }
    }, {
        Field: "Mix",
        Exp: {
            mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010100"], equ: "+"
        }
    }, {
        Field: "Price",
        Exp: {
            mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010100"], equ: "+"
        }
    }
    , {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02010200", description: "SBEW", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Budget: true,
        Exp: {
            mode: "refrence", list: "Budget_PL", fields: ["PL03010103"], equ: "+"
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010103"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }
    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02010300", description: "VC", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Budget: true,
        Exp: {
            mode: "refrence", list: "Budget_PL", fields: ["PL03010104"], equ: "+"
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010104"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: { mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }

    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02010000", description: "VM", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "All",
        Exp: {
            mode: "search", fields: ["VM02010100", "VM02010200", "VM02010300"], equ: "+"
        }
    }]
},

{ emptyrow: true, description: "N-1", bold: true },
{ accountcode: "VM02020100", description: "Sales", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010102"], equ: "+", lastyear: true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010102"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: { mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }

    },
       {
          Field: "Vol",
          Exp: {
              mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010200"], equ: "+"
          }
      }, {
          Field: "Mix",
          Exp: {
              mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010200"], equ: "+"
          }
      }, {
          Field: "Price",
          Exp: {
              mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010200"], equ: "+"
          }
      }
    ,
     {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02020200", description: "SBEW", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010103"], equ: "+", lastyear: true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010103"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }
    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02020300", description: "VC", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010104"], equ: "+", lastyear: true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010104"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true

        }
    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02020000", description: "VM", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "All",
        Exp: {
            mode: "search", fields: ["VM02020100", "VM02020200", "VM02020300"], equ: "+"
        }
    }]
},
{ emptyrow: true, description: "FCST M-1", bold: true },

{ accountcode: "VM02030100", description: "Sales", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Forecast:true,
        Exp: {
            mode: "refrence", list: "Forecast_PL", fields: ["PL04010102"], equ: "+", lastyear: false,lastmonth:true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010102"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: { mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }

    },
       {
           Field: "Vol",
           Exp: {
               mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010300"], equ: "+"
           }
       }, {
           Field: "Mix",
           Exp: {
               mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010300"], equ: "+"
           }
       }, {
           Field: "Price",
           Exp: {
               mode: "refrence", list: "Actual_Flash_VM", manual: true, fields: ["VM01010300"], equ: "+"
           }
       }
    ,
     {
         Field: "Control",
         Exp: {
             mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
         }
     }, {
         Field: "Control1",
         Exp: {
             mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
         }
     }
    ]
},
{ accountcode: "VM02030200", description: "SBEW", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Forecast: true,
        Exp: {
            mode: "refrence", list: "Forecast_PL", fields: ["PL04010103"], equ: "+", lastyear: false, lastmonth: true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010103"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true
        }
    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02030300", description: "VC", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "Budget",
        Forecast: true,
        Exp: {
            mode: "refrence", list: "Forecast_PL", fields: ["PL04010104"], equ: "+", lastyear: false, lastmonth: true
        }
    }, {
        Field: "Actual",
        Exp: {
            mode: "refrence", list: "P_L", fields: ["PL02010104"], equ: "+"
        }
    }, {
        Field: "Variance",
        Exp: {
            mode: "search", fields: ["Actual", "Budget"], equ: "-", selfline: true

        }
    }, {
        Field: "Control",
        Exp: {
            mode: "search", fields: ["Variance", "Vol", "Mix", "Price"], equ: "-", selfline: true
        }
    }, {
        Field: "Control1",
        Exp: {
            mode: "search", fields: ["Price", "MP", "FPP", "PRO", "PT", "Others"], equ: "-", selfline: true
        }
    }
    ]
},
{ accountcode: "VM02030000", description: "VM", unit: "", digits: 0, datarow: true,
    Process: [{
        Field: "All",
        Exp: {
            mode: "search", fields: ["VM02030100", "VM02030200", "VM02030300"], equ: "+"
        }
    }]
},
{ emptyrow: true, description: "" },
{ accountcode: "VM02090100", hide: true, description: "SBEW Cost(first products)", datarow: true, index: 0, Process: [{
    Field: "Actual",
    Exp: {
        mode: "refrence", list: "Actual_LoadingFile", fields: ["Freight", "Packaging", "ExportRefund", "Packing", "Rebates", "Warehouse", "Commissions", "ISOTankRental"], query: "First products", equ: "+"
    }
}
, {
    Field: "Budget", //VC
    Exp: {
        mode: "refrence", list: "Actual_LoadingFile", fields: ["VC"], query: "First products", equ: "+"
    }
}]
},
{ accountcode: "VM03090100", hide: true, description: "SBEW Cost(first products)", datarow: true, index: 0, Process: [{
    Field: "Actual",
    Exp: {
        mode: "refrence", list: "Budget_RGC_LoadingFile", fields: ["Freight", "Packaging", "ExportRefund", "Packing", "Rebates", "Warehouse", "Commissions", "ISOTankRental"], query: "First products", equ: "+"
    }
}
, {
    Field: "Budget", //VC
    Exp: {
        mode: "refrence", list: "Budget_RGC_LoadingFile",fields: ["VC"], query: "First products", equ: "+"
    }
}]
}
];

